<template>
	<div class="content">
		<div class="clear">
			<Form inline class="fl">
				<Input type="text" placeholder="个人UUID" class="w200 m-r10" v-model.trim="uuid" />
				<!--<Input type="text" placeholder="手机号码" class="w200 m-r10" v-model.trim="phone" />-->
				<DatePicker type="daterange" split-panels placeholder="请选择时间段" class="w200 m-r10" format="yyyy-MM-dd" @on-change="getTime">
				</DatePicker>
				<Button type="primary" v-on:click="ifGetQuery">查询</Button>
			</Form>
			<Button type="primary" class="fr" @click="$refs['add'].resetFields();addModal = true;">添加</Button>
		</div>
		<Button class="daochu" type="primary" size="large" @click="exportData" :loading="dcShow">
            <Icon type="ios-download-outline"></Icon> 导出</Button>
		<fieldset style="margin-bottom: 10px;">
			<legend>商户充值汇总</legend>
			<div>
				<tbody>
					<tr>
						<td>累计商户充值数量:
							<span class="blue" v-text="agent == null ? '0' : agent"></span>
						</td>
					</tr>
				</tbody>
			</div>
		</fieldset>
		<Table :columns="columns" ref="table" :data='list' :loading="loading" @on-expand="expand"></Table>
		<Page :total="info" show-elevator :page-size="pageSize" show-total @on-change="cuctGetQuery" :current.sync="page"></Page>
		<!--添加商户-->
		<Modal v-model="addModal" title="添加商户" width="50%" :mask-closable="false">
			<Form :label-width="100" :model="addForm" :rules="rules" ref="add">
				<FormItem label="手机号码" prop="addPhone">
					<Input class="w-50" v-model="addForm.addPhone" placeholder="请输入商户手机号码" />
				</FormItem>
				<FormItem label="商户用户名" prop="addName">
					<Input class="w-50" v-model="addForm.addName" placeholder="请输入商户用户名" />
				</FormItem>
			</Form>
			<div slot="footer">
				<Button type="text" size="large" @click="addModal = false;">取消</Button>
				<Button type="primary" size="large" @click="add">添加</Button>
			</div>
		</Modal>
		<!--充值-->
		<Modal v-model="rechargeModal" title="充值" width="50%" :mask-closable="false">
			<Form :label-width="100" :model="rechargeForm" :rules="userIdrule" ref="recharge">
				<FormItem label="充值商户UUID" prop="uuid">
					<Input class="w-50" v-model="rechargeForm.uuid" placeholder="请输入ID" :disabled="true" />
				</FormItem>
				<FormItem label="充值商户名称" prop="userName">
					<Input class="w-50" v-model="rechargeForm.userName" placeholder="请输入商户名称" :disabled="true" />
				</FormItem>
				<FormItem label="充值USDT" prop="userNum">
					<Input class="w-50" v-model="rechargeForm.userNum" placeholder="请输入充值数量" />
				</FormItem>
				<FormItem label="备注" prop="userRem">
					<Input class="w-50" v-model="rechargeForm.userRem" placeholder="请输入备注" />
				</FormItem>
				<FormItem label="充值密码" prop="password">
					<Input class="w-50" v-model="rechargeForm.password" placeholder="请输入充值密码" type="password" />
				</FormItem>
				<FormItem label prop="hint">
					<span class="red m-l10">*请认真检查充值商户信息和充值数量</span>
				</FormItem>
			</Form>
			<div slot="footer">
				<Button type="text" size="large" @click="rechargeModal = false;$refs['recharge'].resetFields();">取消</Button>
				<Button type="primary" size="large" @click="recharge">确定</Button>
			</div>
		</Modal>

		<Modal v-model="accountModal" title="账户流水" width="40%">
			<fieldset style="margin-bottom: 10px;">
				<legend>账户信息</legend>
				<div>
					<table>
						<tbody>
							<tr>
								<td class="padding">
									钱包账户：
									<span class="blue" v-text="Fixed(flow.wallet)"></span>
								</td>
								<td class="padding">
									OTC账户：
									<span class="blue" v-text="Fixed(flow.otc)"></span>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
			</fieldset>
			<Tabs type="card" class="m-t10" v-model="tabsKey" @on-click="liushui(tabsKey,1)">
				<TabPane label="钱包账户" name="1">
					<Table height="400" stripe :columns="columns2" :data="contributions" ref="table2" :loading="loading2"></Table>
					<Page :total="info2" show-elevator :page-size="pageSize2" show-total @on-change="cuctGetQuery2" :current.sync="current2" ref="page2"></Page>
				</TabPane>
				<TabPane label="OTC账户" name="3">
					<Table height="400" stripe :columns="columns2" :data="contributions2" ref="table3" :loading="loading3"></Table>
					<Page :total="info3" show-elevator :page-size="pageSize2" show-total @on-change="cuctGetQuery2" :current.sync="current3" ref="page3"></Page>
				</TabPane>
			</Tabs>
		</Modal>

		<Modal v-model="complaintModal" title="被投诉记录" width="70%">
			<Table height="400" stripe :columns="columns4" :data="complaintList" ref="table4" :loading="loading4"></Table>
			<Page :total="info4" show-elevator :page-size="pageSize2" show-total @on-change="cuctGetQuery4" :current.sync="current4" ref="page4"></Page>
		</Modal>

		<Modal v-model="rechargeListModal" title="充值列表" width="70%">
			<fieldset style="margin-bottom: 10px;">
				<legend>商户充值汇总</legend>
				<div>
					<table>
						<tbody>
							<tr>
								<td class="padding">
									累计商户充值数量：
									<span class="blue" v-text="OTCAgent == null ? '0' : OTCAgent"></span>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
			</fieldset>
			<Table height="400" stripe :columns="columns5" :data="rechargeList" ref="table5" :loading="loading5"></Table>
			<Page :total="info5" show-elevator :page-size="pageSize" show-total @on-change="cuctGetQuery5" :current.sync="current5" ref="page5"></Page>
		</Modal>
	</div>
</template>

<script>
	import expandRow from './table-expand.vue';
	export default {
		components: {
			expandRow
		},
		data() {
			return {
				dcShow: false,
				loading: true,
				loading2: true,
				loading3: true,
				loading4: true,
				loading5: true,
				jsonData: [],
				list: [], // 分享收益列表数据
				info: null, // 总条数
				info2: null, // 总条数
				info3: null, // 总条数
				info4: null, // 总条数
				info5: null, // 总条数
				page: 1, // 页数
				page2: 1, // 页数
				page3: 1, // 页数
				page4: 1, // 页数
				page5: 1, // 页数
				pageSize: 20, // 每页多少条
				pageSize2: 10, // 每页多少条
				current: 1,
				current2: 1,
				current3: 1,
				current4: 1,
				current5: 1,
				downList: [],
				dataValue: ['', ''], // 时间段值
				uuid: '', // 用户 ID
				phone: '', //手机号码
				addModal: false, //添加Modal
				rechargeModal: false, //充值Modal
				accountModal: false,
				complaintModal: false, //被投诉记录
				rechargeListModal: false, //充值列表
				tabsKey: '1',
				lsId: '',
				contributions: [],
				contributions2: [],
				complaintList: [], //投诉记录
				complaintId: '',
				agent: '', //充值汇总
				OTCAgent: '', //商户充值汇总
				rechargeList: [], // 汇总列表
				childList: new Array,
				childInfo: 0,
				childLoading: true,
				addForm: {
					addPhone: '',
					addName: '',
				}, //充值参数
				rechargeForm: {
					id: '',
					uuid: '',
					userName: '',
					userNum: '',
					password: '',
					userRem: '',
				},
				flow: {
					wallet: '',
					otc: '',
				},
				rules: {
					addPhone: [{
							required: true,
							message: '请输入商户手机号码',
							trigger: 'blur',
						},
						{
							message: '请输入格式正确的手机号码',
							trigger: 'blur',
							min: 11,
						}
					],
					addName: [{
						required: true,
						message: '请输入商户用户名',
						trigger: 'blur',
					}]
				},
				userIdrule: {
					userNum: [{
						required: true,
						message: '请输入充值数量',
						trigger: 'blur',
					}],
					password: [{
						required: true,
						message: '请输入充值密码',
						trigger: 'blur',
					}],
					userRem: [{
						required: true,
						message: '请输入备注',
						trigger: 'blur',
					}]
				},
				columns: [{
					type: 'expand',
					width: 50,
					render: (h, params) => {
						return h(expandRow, {
							props: {
								list: this.childList,
								loading: this.childLoading,
								id: params.row.uuid,
								info: this.childInfo,
							},
							on: {
								success: (params) => {
									this.childLoading = true;
									this.axios.post('/admin/otc/getOtcOrder', this.qs.stringify(params)).then(res => {
										if(res.data.code == 200) {
											this.childList = res.data.data.records;
											this.childInfo = res.data.data.total;
											this.childLoading = false;
										}
									})
								},
							}
						})
					}
				}, {
					title: '用户ID',
					align: 'center',
					key: 'uuid',
					render: (h, params) => {
						return h('div', params.row.uuid == null ? '#' : params.row.uuid)
					}
				}, {
					title: '商户名称',
					align: 'center',
					key: 'otcName',
					render: (h, params) => {
						return h('div', params.row.otcName == null ? '#' : params.row.otcName)
					}
				}, {
					title: '手机号码',
					align: 'center',
					key: 'userName',
					render: (h, params) => {
						return h('div', params.row.userName == null ? '#' : params.row.userName)
					}
				}, {
					title: '姓名',
					align: 'center',
					key: 'trueName',
					render: (h, params) => {
						return h('div', params.row.trueName == null ? '暂未推荐实名用户' : params.row.trueName)
					}
				}, {
					title: '身份证号码',
					align: 'center',
					key: 'idCard',
					render: (h, params) => {
						return h('div', params.row.idCard == null ? '#' : params.row.idCard)
					}
				}, {
					title: '钱包账户',
					align: 'center',
					key: 'coinAvailableNum',
					render: (h, params) => {
						return h('div', params.row.coinAvailableNum == null ? '#' : this.Fixed(params.row.coinAvailableNum))
					}
				}, {
					title: 'OTC账户(可用)',
					align: 'center',
					key: 'otcAvailableNum',
					render: (h, params) => {
						return h('div', params.row.otcAvailableNum == null ? '#' : this.Fixed(params.row.otcAvailableNum))
					}
				}, {
					title: 'OTC账户(冻结)',
					align: 'center',
					key: 'otcFreezeNum',
					render: (h, params) => {
						return h('div', params.row.otcFreezeNum == null ? '#' : this.Fixed(params.row.otcFreezeNum))
					}
				}, {
					title: '注册时间',
					align: 'center',
					key: 'createTime',
					sortable: true,
					render: (h, params) => {
						return h('div', params.row.createTime == null ? '#' : this.stringToTime(params.row.createTime))
					}
				}, {
					title: "账号状态",
					align: "center",
					key: "status",
					render: (h, params) => {
						return h("div", [
							h(
								"Button", {
									props: {
										type: params.row.status == "冻结" ? "error" : 'primary',
										size: "small"
									},
									style: {
										marginRight: "5px"
									},
									on: {
										click: () => {
											this.userStatus(params.row.id, params.row.status == "冻结" ? 2 : 1);
										}
									}
								},
								params.row.status
							)
						]);
					}
				}, {
					title: "操作",
					key: "action",
					width: 400,
					align: "center",
					render: (h, params) => {
						return h("div", [
							h(
								"Button", {
									props: {
										type: "primary",
										size: "small",
										disabled: params.row.status == "冻结" ? false : true
									},
									style: {
										marginRight: "5px"
									},
									on: {
										click: () => {
											this.$refs['recharge'].resetFields();
											this.rechargeModal = true;
											this.rechargeForm.uuid = params.row.uuid;
											this.rechargeForm.id = params.row.id;
											this.rechargeForm.userName = params.row.userName;
										}
									}
								},
								"充值"
							),
							h(
								"Button", {
									props: {
										type: "primary",
										size: "small"
									},
									style: {
										marginRight: "5px"
									},
									on: {
										click: () => {
											this.lsId = params.row.id;
											this.tabsKey = '1';
											this.liushui(1, 1);
										}
									}
								},
								"账户流水"
							),
							h(
								"Button", {
									props: {
										type: "primary",
										size: "small",
									},
									style: {
										marginRight: "5px"
									},
									on: {
										click: () => {
											this.childLoading = true;
											//如果点击的行为未展开状态，那么不执行任何操作，反之执行取消所有展开状态，只展开当前行
											this.list.forEach((row2, i) => {
												if(row2.id === params.row.id) {
													if(this.$refs.table.$refs.tbody.objData[i]._isExpanded) {
														this.$refs.table.$refs.tbody.objData[i]._isExpanded = false;
													} else {
														this.$refs.table.$refs.tbody.objData[i]._isExpanded = true;
														this.axios.post('/admin/otc/getOtcOrder', this.qs.stringify({
															current: '1',
															size: 10,
															uuid: row2.uuid,
															orderNum: '',
															username: '',
															type: '',
															status: '',
															startTime: '',
															endTime: '',
														})).then(res => {
															if(res.data.code == 200) {
																this.childList = res.data.data.records;
																this.childInfo = res.data.data.total;
																this.childLoading = false;
															}
														})
													}
												} else {
													this.$refs.table.$refs.tbody.objData[i]._isExpanded = false;
												}
											})
										}
									}
								},
								"查看发布记录"
							),
							h(
								"Button", {
									props: {
										type: "primary",
										size: "small",
									},
									style: {
										marginRight: "5px"
									},
									on: {
										click: () => {
											this.complaintModal = true;
											this.loading4 = true;
											this.axios.post('/admin/otc/getOtcAppealedRecord', this.qs.stringify({
												size: this.pageSize2,
												current: this.page4,
												userId: params.row.id
											})).then(res => {
												if(res.data.code) {
													this.complaintList = res.data.data.records;
													this.info4 = res.data.data.total;
													this.complaintId = params.row.id;
													this.loading4 = false;
												}
											})
										}
									}
								}, "被投诉记录"
							),
							h(
								"Button", {
									props: {
										type: "primary",
										size: "small",
									},
									style: {
										marginRight: "5px"
									},
									on: {
										click: () => {
											this.rechargeListModal = true;
											this.axios.get('/admin/accounting/recharge/getRechargeList', {
												params: {
													current: this.page, // 当前页【可选，默认1】
													size: this.pageSize, // 每页记录数【可选，默认20】
													uuid: params.row.uuid,
													startTime: '', // 起始日期
													endTime: '', // 结束日期
												}
											}).then(res => {
												if(res.data.code == 200) {
													this.rechargeList = res.data.data.records;
													this.info5 = res.data.data.total;
													this.loading5 = false;
												}
											})
											this.axios.get('/admin/accounting/recharge/dl/' + params.row.uuid).then(res => {
												if(res.data.code == 200) {
													this.OTCAgent = res.data.data;
												}
											})
										}
									}
								}, "充值列表"
							),
						]);
					}
				}],
				columns2: [{
						title: "时间",
						align: "center",
						key: "dateTime",
						sortable: true,
						render: (h, params) => {
							return h("div", params.row.dateTime == null ? "#" : params.row.dateTime);
						}
					},
					{
						title: "数量",
						align: "center",
						key: "num",
						render: (h, params) => {
							return h("div", params.row.num == null ? "#" : params.row.num);
						}
					},
					{
						title: "类型",
						align: "center",
						key: "type",
						render: (h, params) => {
							return h("div", params.row.type == null ? "#" : params.row.type);
						}
					}
				],
				columns4: [{
					title: '申诉方',
					key: 'createMemberId',
					render: (h, params) => {
						return h('div', params.row.createMemberId == null ? '#' : params.row.createMemberId == params.row.memberId ? '用户' : '商户')
					}
				}, {
					title: '商户名',
					key: 'otcUserName',
					render: (h, params) => {
						return h('div', params.row.otcUserName == null ? '#' : params.row.otcUserName)
					}
				}, {
					title: '用户名',
					key: 'userName',
					render: (h, params) => {
						return h('div', params.row.userName == null ? '#' : params.row.userName)
					}
				}, {
					title: '凭证',
					key: 'credentials',
					render: (h, params) => {
						return h('div', [
							h('img', {
								attrs: {
									src: params.row.credentials,
									preview: '1'
								},
								style: {
									width: '70px',
									height: '70px',
									margin: '10px 0'
								}
							})
						])
					}
				}, {
					title: '申诉备注',
					key: 'appealRemark',
					render: (h, params) => {
						return h('div', params.row.appealRemark == null ? '#' : params.row.appealRemark)
					}
				}, {
					title: '处理结果备注',
					key: 'resultsRemark',
					render: (h, params) => {
						return h('div', params.row.resultsRemark == null ? '#' : params.row.resultsRemark)
					}
				}, {
					title: '处理结果',
					key: 'processingResults',
					render: (h, params) => {
						return h('div', params.row.processingResults == null ? '#' : params.row.processingResults == 0 ? '未处理' : '已处理');
					}
				}],
				columns5: [{
						title: '充值编号',
						key: 'tradeId',
						align: 'center',
						render: (h, params) => {
							return h('div', params.row.tradeId == null ? '#' : params.row.tradeId);
						}
					},
					{
						title: '充值数量',
						key: 'num',
						align: 'center',
						render: (h, params) => {
							return h('div', params.row.num == null ? '#' : this.Fixed(params.row.num));
						}
					},
					{
						title: '操作人名称',
						key: 'rechargeName',
						align: 'center',
						render: (h, params) => {
							return h('div', params.row.rechargeName == null ? '#' : params.row.rechargeName)
						}
					},
					{
						title: '操作人手机号',
						key: 'rechargePhone',
						align: 'center',
						render: (h, params) => {
							return h('div', params.row.rechargePhone == null ? '#' : params.row.rechargePhone)
						}
					},
					{
						title: '备注',
						key: 'remark',
						align: 'center',
						render: (h, params) => {
							return h('div', params.row.remark == null ? '#' : params.row.remark)
						}
					},
					{
						title: '充值时间',
						key: 'createTime',
						align: 'center',
						sortable: true,
						render: (h, params) => {
							return h('div', params.row.createTime == null ? '#' : this.stringToTime(params.row.createTime))
						}
					}
				],
			}
		},
		created() {

		},
		mounted() {
			this.$Message.config({
				top: 250
			})
			this.getQuery() // 查询
		},
		methods: {
			exportData() {
				this.jsonData = [];
				this.dcShow = true;
				this.axios.post('/admin/otc/getOtcMember', this.qs.stringify({
					current: 1, // 当前页【可选，默认1】
					size: 20, // 每页记录数【可选，默认20】
					uuid: this.uuid,
					username: this.phone,
					startTime: this.dataValue[0] == "" ? "" : this.dataValue[0] + ' 00:00:00',
					endTime: this.dataValue[1] == "" ? "" : this.dataValue[1] + ' 23:59:59'
				})).then(res => {
					if(res.data.code == 200) {
						this.axios.post('/admin/otc/getOtcMember', this.qs.stringify({
							current: 1, // 当前页【可选，默认1】
							size: res.data.data.total, // 每页记录数【可选，默认20】
							uuid: this.uuid,
							username: this.phone,
							startTime: this.dataValue[0] == "" ? "" : this.dataValue[0] + ' 00:00:00',
							endTime: this.dataValue[1] == "" ? "" : this.dataValue[1] + ' 23:59:59'
						})).then(res => {
							if(res.data.code == 200) {
								this.downList = res.data.data.records;
								this.downList.forEach((row, index) => {
									this.downList[index].createTime = this.stringToTime(this.downList[index].createTime);
									this.downList[index].uuid = this.downList[index].uuid == null ? '#' : this.downList[index].createTime;
									this.downList[index].otcName = this.downList[index].otcName == null ? '#' : this.downList[index].otcName;
									this.downList[index].userName = this.downList[index].userName == null ? '#' : this.downList[index].userName;
									this.downList[index].trueName = this.downList[index].trueName == null ? '#' : this.downList[index].trueName;
									this.downList[index].idCard = this.downList[index].idCard == null ? '#' : this.downList[index].idCard;
									this.downList[index].coinAvailableNum = this.downList[index].coinAvailableNum == null ? '#' : this.Fixed(this.downList[index].coinAvailableNum);
									this.downList[index].otcAvailableNum = this.downList[index].otcAvailableNum == null ? '#' : this.Fixed(this.downList[index].otcAvailableNum);
									this.downList[index].otcFreezeNum = this.downList[index].otcFreezeNum == null ? '#' : this.Fixed(this.downList[index].otcFreezeNum);
									this.downList[index].status = this.downList[index].status == null ? '#' : this.downList[index].status == 1 ? "正常" : this.downList[index].status == 2 ? "冻结" : "#"
									this.jsonData.push({
										uuid: this.downList[index].uuid,
										otcName: this.downList[index].otcName,
										userName: this.downList[index].userName,
										trueName: this.downList[index].trueName,
										idCard: this.downList[index].idCard,
										coinAvailableNum: this.downList[index].coinAvailableNum,
										otcAvailableNum: this.downList[index].otcAvailableNum,
										otcFreezeNum: this.downList[index].otcFreezeNum,
										status: this.downList[index].status,
										createTime: this.downList[index].createTime,
									})
								})
								let str = `用户ID,商户名称,手机号码,姓名,身份证号码,钱包账户,OTC账户(可用),OTC账户(冻结),账号状态,注册时间\n`;
								this.downLoad(this.jsonData, str, '商户列表');
							}
						})
					}
				})
			},
			// 处理时间段时间格式
			getTime(daterange) {
				this.dataValue = daterange;
			},
			getQuery() {
				this.loading = true;
				this.axios.post('/admin/otc/getOtcMember', this.qs.stringify({
					current: this.page, // 当前页【可选，默认1】
					size: this.pageSize, // 每页记录数【可选，默认20】
					uuid: this.uuid,
					username: this.phone,
					startTime: this.dataValue[0] == "" ? "" : this.dataValue[0] + ' 00:00:00',
					endTime: this.dataValue[1] == "" ? "" : this.dataValue[1] + ' 23:59:59'
				})).then(res => {
					if(res.data.code == 200) {
						this.list = res.data.data.records;
						this.list.forEach((row, index) => {
							this.list[index].status = row.status == 1 ? "冻结" : row.status == 2 ? "解冻" : "#";
						});
						this.info = res.data.data.total;
						this.loading = false;
					}
				})
				this.axios.get('/admin/accounting/recharge/dlsum').then(res => {
					if(res.data.code == 200) {
						this.agent = res.data.data;
					}
				})
			},
			cuctGetQuery(page) { // 分页查询直推奖励
				this.loading = true;
				this.axios.post('/admin/otc/getOtcMember', this.qs.stringify({
					current: page, // 当前页【可选，默认1】
					size: this.pageSize2, // 每页记录数【可选，默认20】
					uuid: this.uuid,
					username: this.phone,
					startTime: this.dataValue[0] == "" ? "" : this.dataValue[0] + ' 00:00:00',
					endTime: this.dataValue[1] == "" ? "" : this.dataValue[1] + ' 23:59:59'
				})).then(res => {
					if(res.data.code == 200) {
						this.list = res.data.data.records;
						this.list.forEach((row, index) => {
							this.list[index].status = row.status == 1 ? "冻结" : row.status == 2 ? "解冻" : "#";
						});
						this.info = res.data.data.total;
						this.loading = false;
					}
				})
			},
			cuctGetQuery2(page) {
				this.getUser(this.lsType, page);
			},
			cuctGetQuery4(page) {
				this.loading4 = true;
				this.axios.post('/admin/otc/getOtcAppealedRecord', this.qs.stringify({
					size: this.pageSize2,
					current: page,
					userId: this.complaintId
				})).then(res => {
					if(res.data.code) {
						this.complaintList = res.data.data.records;
						this.info4 = res.data.data.total;
						this.loading4 = false;
					}
				})
			},
			cuctGetQuery5(page) {
				this.loading5 = true;
			},
			ifGetQuery() { // 条件查询直推奖励
				this.page = 1;
				this.loading = true;
				this.axios.post('/admin/otc/getOtcMember', this.qs.stringify({
					current: this.page, // 当前页【可选，默认1】
					size: this.pageSize, // 每页记录数【可选，默认20】
					uuid: this.uuid,
					username: this.phone,
					startTime: this.dataValue[0] == "" ? "" : this.dataValue[0] + ' 00:00:00',
					endTime: this.dataValue[1] == "" ? "" : this.dataValue[1] + ' 23:59:59'
				})).then(res => {
					if(res.data.code == 200) {
						this.list = res.data.data.records;
						this.list.forEach((row, index) => {
							this.list[index].status = row.status == 1 ? "冻结" : row.status == 2 ? "解冻" : "#";
						});
						this.info = res.data.data.total;
						this.loading = false;
					}
				})
			},
			add() {
				this.$refs['add'].validate(validate => {
					if(validate) {
						this.axios.post('/admin/otc/addOtcMember', this.qs.stringify({
							username: this.addForm.addPhone,
							otcName: this.addForm.addName
						})).then(res => {
							if(res.data.code == 200) {
								this.$Message.info(res.data.msg);
								this.getQuery();
								this.addModal = false;
							}
						})
					}
				})
			},
			userStatus(id, statusId) {
				let _this = this;
				let statusText = "";

				if(statusId == "2") {
					statusText = "冻结";
				} else {
					statusText = "解冻";
				}

				this.$Modal.confirm({
					title: statusText + "账号",
					content: "是否要" + statusText + "该用户",
					onOk: function() {
						let params = this.qs.stringify({
							userId: id,
							status: statusId
						});
						_this.axios.post("/admin/account/member/freezeOrUnFreezeUser", params).then(res => {
							if(res.data.code == 200) {
								_this.$Message.info(res.data.msg);
								_this.getQuery();
							} else if(res.data.code == 500) {
								_this.$Message.info(res.data.msg);
							}
						});
					}
				});
			},
			recharge() {
				this.$refs['recharge'].validate(validate => {
					if(validate) {
						let params = this.qs.stringify({
							userId: this.rechargeForm.id,
							num: this.rechargeForm.userNum,
							remark: this.rechargeForm.userRem,
							rechargePass: this.rechargeForm.password,
						});
						this.axios.post("/admin/account/member/rechargeAccount", params).then(res => {
							if(res.data.code == 200) {
								this.$Message.info(res.data.msg);
								this.getQuery();
								this.rechargeModal = false;
								this.$refs['recharge'].resetFields();
							}
						});
					}
				})
			},
			// 查看流水
			liushui(type, current) {
				this.accountModal = true;
				this.getUser(type, current);
				this.$refs['page2'].currentPage = 1;
				this.$refs['page3'].currentPage = 1;
			},
			// 获取账户流水
			getUser(type, current) {
				this.loading2 = true;
				this.loading3 = true;
				type = Number(type);
				this.lsType = type;
				this.axios.post("/admin/account/member/statistical/getAccountDetail", this.qs.stringify({
					id: this.lsId,
					size: this.pageSize2,
					current: current,
					paymentType: type //1 钱包账户 2 币币账户 3 OTC账户 4 挖矿账户
				})).then(res => {
					if(res.data.code == 200) {
						this.flow = res.data.data.Balance;
						switch(type) {
							case 1:
								this.contributions = res.data.data.list.records;
								this.info2 = res.data.data.list.total;
								this.loading2 = false;
								break;
							case 3:
								this.contributions2 = res.data.data.list.records;
								this.info3 = res.data.data.list.total;
								this.loading3 = false;
								break;
						}

					} else if(res.data.code == 500) {
						this.$Message.info(res.data.msg);
					}
				});
			},
			expand(row, status) {
				this.childLoading = true;
				//如果点击的行为未展开状态，那么不执行任何操作，反之执行取消所有展开状态，只展开当前行
				if(!status) {
					return false;
				}
				this.list.forEach((row2, i) => {
					if(row2.id === row.id) {
						this.$refs.table.$refs.tbody.objData[i]._isExpanded = true;
						this.axios.post('/admin/otc/getOtcOrder', this.qs.stringify({
							current: this.page,
							size: this.pageSize,
							uuid: row2.uuid,
							orderNum: '',
							username: '',
							type: '',
							status: '',
							startTime: '',
							endTime: '',
						})).then(res => {
							if(res.data.code == 200) {
								this.childList = res.data.data.records;
								this.childInfo = res.data.data.total;
								this.childLoading = false;
							}
						})
					} else {
						this.$refs.table.$refs.tbody.objData[i]._isExpanded = false;
					}
				})
			},
		}
	}
</script>

<style>

</style>